/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boogie.assetgenerator.data;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author boogie
 */
public class AssetFolder {
    private final List<Asset> assets;
    private final List<AssetFolder> folders;
    private boolean hasParrent = false;

    private String name;
    
    public AssetFolder(String name){
        this.name = name;
        assets = new LinkedList<Asset>();
        folders = new LinkedList<AssetFolder>();
    }

    public AssetFolder() {
        assets = new LinkedList<Asset>();
        folders = new LinkedList<AssetFolder>();
    }

    public String getName() {
        return name;
    }

    public List<AssetFolder> getFolders() {
        return folders;
    }

    public List<Asset> getAssets() {
        return assets;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public void addFolder(AssetFolder folder){
        
        folder.hasParrent = true;
        folders.add(folder);
    }
    
    public void addAsset(Asset asset){
        
        this.assets.add(asset);
    }

    @Override
    public String toString() {
        String s = "public "+(hasParrent?"static ":"")+"final class "+name+"{\n";
        
        
        if(assets!=null) {
            for(Asset a :assets){
                if(hasParrent){
                    s+="\t\t";
                }
                s+=a.toString()+"\n";
            }
        }
        if(folders!=null) {
            for(AssetFolder f: folders){
                s+="\t"+f.toString();
            }
        }
        
        s+="\n}\n";
        return s;
    }
    
    
    
}
